import { getBaseUrl } from '@/services/urlconst';
import { getCompanyID, getPosIDs, getUserDepID, getUserID, requestFunComponFiex, getTenantID } from '@/utils';
import { ILoadMapTypeAll } from '@/common';
import { useRequest } from 'umi';

let baseUrl = getBaseUrl();
// let baseUrl = '/wenchuang'; // 本地mock

/**
 * 获取组合资产详情
 * @param getDetailCallback
 * @returns
 */
const getDetailService = (getDetailCallback: (res: any) => void) => {
  const getDetail = useRequest(
    (id: any) => {
      let personUrl = `${baseUrl}/assetInfo/resultantAssetDetail`;
      let bodyParams = {
        id,
      };
      return requestFunComponFiex('POST', personUrl, bodyParams);
    },
    {
      manual: true,
      onSuccess: (res) => {
        getDetailCallback(res);
      },
    },
  );
  return {
    getDetailRun: getDetail?.run,
    getDetailLoading: getDetail?.loading,
  };
};

export { getDetailService };
